SELECT 
files.type_desc as FileType,
files.name as FileName, 
REVERSE(SUBSTRING(REVERSE(files.physical_name),0,CHARINDEX('\',REVERSE(files.physical_name)))) as FullFileName, 
substring(files.physical_name,0,charindex(reverse(SUBSTRING(reverse(files.physical_name),0,CHARINDEX('\',REVERSE(files.physical_name)))),files.physical_name,0)) as Folder
FROM sys.master_files files
inner join [sys].[databases] db
on db.database_id = files.database_id
where db.name = '{0}'